package com.zero.basic.dao;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

@Repository("hqlUpdateBaseDao")
public class HqlUpdateBaseDao<T> extends DefaultBaseDao<T> {
	
	/**
	 * Update the object by HQL
	 * @param hql
	 * @param args
	 */
	public void updateByHql(String hql, Object[] args) {
		Query query = getSession().createQuery(hql);
		setParameter(query, args);
		query.executeUpdate();
	}
	public void updateByHql(String hql, Object arg) {
		this.updateByHql(hql,new Object[]{arg});
	}
	public void updateByHql(String hql) {
		this.updateByHql(hql,null);
	}
}